﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"             
    mc:Ignorable="d"
    xmlns:l="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
    x:Class="SmartSpace.Silverlight.SlEditor"
    d:DesignHeight="600" d:DesignWidth="890" HorizontalAlignment="Stretch">
    <Border BorderThickness="1">
        <Grid Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <StackPanel Name="m_stackPanelToolbar" Grid.Row="0" Orientation="Horizontal">
                <!--Clipboard Toolbar Section-->
                <Button x:Name="btnCopy" Click="btnCopy_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="复制"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Copy.png" Width="16" Height="16"/>
                </Button>
                <Button x:Name="btnCut" Click="btnCut_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="剪切"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Cut.png" Width="16" Height="16"/>
                </Button>
                <Button x:Name="btnPaste" Click="btnPaste_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="粘贴"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Paste.png" Width="16" Height="16"/>
                </Button>

                <TextBlock Text="字体:" VerticalAlignment="Center" Margin="5,0,0,0"/>
                <!--Fonts Toolbar Section-->
                <ComboBox x:Name="cmbFonts" Width="120"  FontFamily="{Binding SelectedItem.FontFamily, RelativeSource={RelativeSource Self}}" FontSize="{Binding SelectedItem.FontSize, RelativeSource={RelativeSource Self}}" SelectionChanged="cmbFonts_SelectionChanged">

                    <ComboBoxItem Content="宋体（英文不等宽）" Tag="SimSun" FontFamily="SimSun" FontSize="12"/>
                    <ComboBoxItem Content="宋体（英文等宽）" Tag="NSimSun" FontFamily="NSimSun" FontSize="12"/>
                    <ComboBoxItem Content="楷体" Tag="KaiTi" FontFamily="KaiTi" FontSize="12"/>
                    <ComboBoxItem Content="黑体" Tag="SimHei" FontFamily="SimHei" FontSize="12"/>
                    <ComboBoxItem Content="仿宋" Tag="FangSong" FontFamily="FangSong" FontSize="12"/>
                    <ComboBoxItem Content="微软正黑体" Tag="Microsoft JhengHei" FontFamily="Microsoft JhengHei" FontSize="12"/>
                    <ComboBoxItem Content="细明体" Tag="MingLiu" FontFamily="MingLiu" FontSize="12"/>
                    <ComboBoxItem Content="微软雅黑" Tag="Microsoft YaHei" FontFamily="Microsoft YaHei" FontSize="12"/>

                    <ComboBoxItem Content="Arial" Tag="Arial" FontFamily="Arial" FontSize="12"/>
                    <ComboBoxItem Content="Arial Black" Tag="Arial Black" FontFamily="Arial Black" FontSize="12"/>
                    <ComboBoxItem Content="Calibri" Tag="Calibri" FontFamily="Calibri" IsSelected="True" FontSize="14"/>
                    <ComboBoxItem Content="Comic Sans MS" Tag="Comic Sans MS" FontFamily="Comic Sans MS" FontSize="12"/>
                    <ComboBoxItem Content="Courier New" Tag="Courier New" FontFamily="Courier New" FontSize="12"/>
                    <ComboBoxItem Content="Georgia" Tag="Georgia" FontFamily="Georgia" FontSize="12"/>
                    <ComboBoxItem Content="Lucida Sans Unicode" Tag="Lucida Sans Unicode" FontFamily="Lucida Sans Unicode" FontSize="12"/>
                    <ComboBoxItem Content="Portable User Interface" Tag="{x:Null}" FontFamily="Portable User Interface" FontSize="12"/>
                    <ComboBoxItem Content="Times New Roman" Tag="Times New Roman" FontFamily="Times New Roman" FontSize="12"/>
                    <ComboBoxItem Content="Trebuchet MS" Tag="Trebuchet MS" FontFamily="Trebuchet MS" FontSize="12"/>
                    <ComboBoxItem Content="Verdana" Tag="Verdana" FontFamily="Verdana" FontSize="12"/>
                </ComboBox>

                <TextBlock Text="大小:" VerticalAlignment="Center" Margin="5,0,0,0"/>
                <ComboBox x:Name="cmbFontSizes" Width="50" SelectionChanged="cmbFontSizes_SelectionChanged">
                    <ComboBoxItem Content="8" Tag="8"/>
                    <ComboBoxItem Content="9" Tag="9"/>
                    <ComboBoxItem Content="10" Tag="10"/>
                    <ComboBoxItem Content="11" Tag="11"/>
                    <ComboBoxItem Content="12" Tag="12" IsSelected="True"/>
                    <ComboBoxItem Content="14" Tag="14"/>
                    <ComboBoxItem Content="16" Tag="16"/>
                    <ComboBoxItem Content="18" Tag="18"/>
                    <ComboBoxItem Content="20" Tag="20"/>
                    <ComboBoxItem Content="22" Tag="22"/>
                    <ComboBoxItem Content="24" Tag="24"/>
                    <ComboBoxItem Content="26" Tag="26"/>
                    <ComboBoxItem Content="28" Tag="28"/>
                    <ComboBoxItem Content="36" Tag="36"/>
                    <ComboBoxItem Content="48" Tag="48"/>
                    <ComboBoxItem Content="72" Tag="72"/>
                </ComboBox>

                <TextBlock Text="颜色" VerticalAlignment="Center" Margin="5,0,0,0"/>
                <ComboBox x:Name="cmbFontColors" SelectionChanged="cmbFontColors_SelectionChanged" Width="50"  SelectedIndex="0">
                    <ComboBoxItem Tag="FFFF0000">
                        <Rectangle Width="22" Height="14" Fill="Red" Margin="2,0,0,0" />
                    </ComboBoxItem>
                    <ComboBoxItem Tag="FF008000">
                        <Rectangle Width="22" Height="14" Fill="Green" Margin="2,0,0,0" />
                    </ComboBoxItem>
                    <ComboBoxItem Tag="FF0000FF">
                        <Rectangle Width="22" Height="14" Fill="Blue" Margin="2,0,0,0" />
                    </ComboBoxItem>
                    <ComboBoxItem Tag="FFFFFF00">
                        <Rectangle Width="22" Height="14" Fill="Yellow" Margin="2,0,0,0" />
                    </ComboBoxItem>
                    <ComboBoxItem Tag="FF000000" IsSelected="True">
                        <Rectangle Width="22" Height="14" Fill="Black" Margin="2,0,0,0" />
                    </ComboBoxItem>
                </ComboBox>

                <!--Buttons-->
                <Button x:Name="btnBold" Click="btnBold_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="加粗"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Bold.Png" Width="16" Height="16"/>
                </Button>

                <Button x:Name="btnItalic" Click="btnItalic_Click" Margin="0,0,1,0">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="斜体"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Italic.png" Width="16" Height="16"/>
                </Button>

                <Button x:Name="btnUnderline" Click="btnUnderline_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="下划线"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/Underline.png" Width="16" Height="16"/>
                </Button>

                <Button x:Name="btnAddHeight" Click="btnAddHeight_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="增加区域"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/addHeight.png" Width="16" Height="16"/>
                </Button>

                <Button x:Name="btnDecHeight" Click="btnDecHeight_Click">
                    <ToolTipService.ToolTip>
                        <ToolTip FontSize="16" Content="缩小区域"/>
                    </ToolTipService.ToolTip>
                    <Image Source="Images/decHeight.png" Width="16" Height="16"/>
                </Button>
            </StackPanel>

            <Border Grid.Row="1" BorderThickness="0,1,0,0">
                <Grid Name="RTBGrid">
                    <RichTextBox x:Name="rtb" Height="200" AllowDrop="False" BorderBrush="{x:Null}" MouseRightButtonDown="rtb_MouseRightButtonDown" MouseRightButtonUp="rtb_MouseRightButtonUp" Drop="rtb_Drop" DragEnter="rtb_DragEnter" DragLeave="rtb_DragLeave" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" FontFamily="SimSun" FontSize="14" />
                </Grid>
            </Border>
        </Grid>
    </Border>
</UserControl>
